﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace microCRM
{
    public partial class SysCarePlans : Form
    {
        public SysCarePlans()
        {
            InitializeComponent();
        }

        private void SysCarePlans_Load(object sender, EventArgs e)
        {
            BindingSource source = new BindingSource();
            source.DataSource = DBHelper.GetPlans();
            this.dgv_Results.DataSource = source;
        }

        private void btn_Add_Click(object sender, EventArgs e)
        {
            SysCareAddPlan addPlan = new SysCareAddPlan();
            addPlan.MdiParent = this.MdiParent;
            addPlan.Show();
            addPlan.DataAddedEvent += new SysCareAddPlan.DataAdded(btn_Refresh_Click);
        }

        private void btn_Refresh_Click(object sender, EventArgs e)
        {
            BindingSource source = new BindingSource();
            source.DataSource = DBHelper.GetPlans();
            this.dgv_Results.DataSource = source;
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
